%{
#include "gaxld.y.tab.h"
#include "symboltable.h"
	int yyline = 1;
	int yylval;
	char buf [64];
	char *yytag = buf;
%}
digit [0-9]
hexdigit [0-9a-fA-F]
letter [a-zA-Z_]
alnum {letter}|{digit}
lt <
gt >
space [ \t]
line \n

id {letter}{alnum}*
number {hexdigit}+
invalid .
%%
{line} yyline ++;
{space} ;
".symbol" return SYMBOL;
".text" return TEXT;
".data" return DATA;
"TEXT" {yylval = S_TEXT; return SECTION;}
"DATA" {yylval = S_DATA; return SECTION;}
"LOCAL" {yylval = S_LOCAL; return ACCESS;}
"GLOBAL" {yylval = S_GLOBAL; return ACCESS;}
{lt} return LT;
{gt} return GT;
{number} {sscanf (yytext, "%x", &yylval); return NUMBER;}
{id} {strcpy (yytag, yytext); return ID;}
{invalid} return INVALID;
%%

int yywrap (void)
{
	return 1;
}

